# -*- coding: utf-8 -*-
# !/usr/bin/env python
from utils.mysql_utils import query_to_list


def query_app_info(app_id=''):
    sql_parameter = []

    if app_id:
        sql_fragment = "WHERE a.app_id = %s"
        sql_parameter.append(app_id)
    else:
        sql_fragment = ''

    sql = """
    SELECT *
    FROM apps_configuration a
    %s
    AND a.status != 0
    """%sql_fragment
    data = query_to_list(sql, sql_parameter, True)

    return data
